#ifndef BIN_SEARCH_TREE_
#define BIN_SEARCH_TREE_

#include <stdlib.h>
#include <stdbool.h>

#define MAX_BIN_SEA_TREE 500

#define SLEN 50

//typedef int Item;
//typedef struct {
//    char petname[SLEN];
//    char petkind[SLEN];
//} Item;
//

typedef char * Item;

typedef struct bstnode {
    Item item;
    struct bstnode * left;
    struct bstnode * right;
    int count;
} Bstnode;

typedef struct {
    struct bstnode * root;
    int len;
} BinSeaTree;

typedef int (* BstCompCall)(const Item *, const Item *);

typedef void (*BstCall)(const Item *, int count);

//interface

void InitializeBstree(BinSeaTree *);

bool BstreeIsEmpty(const BinSeaTree *);

bool BstreeIsFull(const BinSeaTree *);

int BstreeCountItem(const BinSeaTree *);

bool BstreeAddItem(Item *, BinSeaTree *, BstCompCall);

bool BstreeInTree(const Item * pi, const BinSeaTree *, BstCompCall);

bool BstreeDelItem(Item *, BinSeaTree *, BstCompCall);

void EmptyTheBstree(BinSeaTree *);

void Traverse(const BinSeaTree *, BstCall);

#endif
